package com.sync.test;

import java.nio.ByteBuffer;

public class BytesVsByteBuffer {

	public static void main(String[] args) {

		long start = System.currentTimeMillis();
		byte[] a = new byte[1024 * 1024 * 10];
		for (int i = 0; i < 100000000; ++i) {
			a[i % 1024] = (byte) i;
			a[i % 1024] = 0;
		}
		System.err.println(System.currentTimeMillis() - start);
		start = System.currentTimeMillis();
		ByteBuffer byteBuffer = ByteBuffer.allocate(1024 * 1024 * 10);
		for (int i = 0; i < 100000000; ++i) {
			byteBuffer.put(i % 1024, (byte) i);
			byteBuffer.get(i % 1024);
		}
		System.err.println(System.currentTimeMillis() - start);
	}

}
